package com.glsc.ngateway.common.base.domain.mysql.gateway.platform.it;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.datatype.jsr310.deser.LocalDateTimeDeserializer;
import com.fasterxml.jackson.datatype.jsr310.ser.LocalDateTimeSerializer;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;

import javax.persistence.*;
import java.io.Serializable;
import java.time.LocalDateTime;

@Data
@Entity
@Table(name = "t_it_cloud_device")
public class ItCloudDevice implements Serializable {

    @Id
    @Column(name = "dev_id")
    private String devId;

    @Column(name = "cloud_id")
    private String cloudId;

    @Column(name = "cloud_style")
    private String cloudStyle;

    @Column(name = "cloud_area")
    private Integer cloudArea;

    @Column(name = "inside_ip")
    private String insideIp;

    @Column(name = "eip")
    private String eip;

    @Column(name = "slb")
    private String slb;

    @Column(name = "operation_sys")
    private String operationSys;

    @Column(name = "cpu")
    private String cpu;

    @Column(name = "memory")
    private String memory;

    @Column(name = "user_id")
    private String userId;

    @Column(name = "manage_control")
    private String manageControl;

    @Column(name = "master_name")
    private String masterName;

    @Column(name = "mark")
    private String mark;

    @Column(name = "application")
    private String application;

    @Column(name = "business_name")
    private String businessName;

    @Column(name = "insert_time", columnDefinition = "datetime comment '创建时间'")
    @org.hibernate.annotations.CreationTimestamp
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @JsonSerialize(using = LocalDateTimeSerializer.class)
    @JsonDeserialize(using = LocalDateTimeDeserializer.class)
    protected LocalDateTime insertTime;

    @Column(name = "update_time", columnDefinition = "datetime comment '更新时间'")
    @org.hibernate.annotations.UpdateTimestamp
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @JsonSerialize(using = LocalDateTimeSerializer.class)
    @JsonDeserialize(using = LocalDateTimeDeserializer.class)
    protected LocalDateTime updateTime;

    @Transient
    private String userAccount;

    @Transient
    private String userName;

    @Transient
    private String department;
}
